local CommonOHOH = _G.CommonOHOH;
local M = CommonOHOH.class.new(script, CommonOHOH.files.Car());
local ConnectClass=_G.CommonOHOH.load.Connect();
local CarTool=_G.CommonOHOH.load.CarTool();
-- local PlayerCharacterHelper=_G.ClientOHOH.load.PlayerCharacterHelper()

-- 初始化PVP辆车
function M.new(...)
	return M(...);
end;

function M.ctor(self,player,isplayer,bodyId,flagId,ringId,tailId,weaponId,isBoom,rivalId)--构造函数

    self.isBoom = isBoom
    self.isPlayer = isplayer
    self.rivalId = rivalId
	M.super.ctor(self,player,bodyId,flagId,ringId,tailId,weaponId);
    
    self.PVPEndEvent=ConnectClass.new() --碰撞事件

end;



function M.dtor(self)
	M.super.dtor(self);
end;

function M.Start(self)
    self:AddProcess(function()
        if self.isPlayer then
            self:AddCharacter(self.player.character.main_inst) --将玩家放置到车上
            self:Wait(1)
        else
            -- if self.rivalId then
            --     PlayerCharacterHelper.GetPlayerCharacter(self.rivalId,function(model)
            --         self:AddCharacter(model) --将对手放置到车上
            --         self:Wait(1)
            --     end)
            -- end
        end
        self:AnchoredSwitch(false) --取消锚固
        self:Wait(0.5)
        self:AddPrivateComponentByFolder(script.startCom) --添加控制器
    end)
end



return M